import request from '@/router/axios';

export const getList = (current, size, params) => {
  return request({
    url: '/api/rb-core/core/terminal/terminal/list',
    method: 'get',
    params: {
      ...params,
      current,
      size,
    }
  })
}

export const getDetail = (id) => {
  return request({
    url: '/api/rb-core/core/terminal/terminal/detail',
    method: 'get',
    params: {
      id
    }
  })
}

export const remove = (ids) => {
  return request({
    url: '/api/rb-core/core/terminal/terminal/remove',
    method: 'post',
    params: {
      ids,
    }
  })
}

export const add = (row) => {
  return request({
    url: '/api/rb-core/core/terminal/terminal/submit',
    method: 'post',
    data: row
  })
}

export const update = (row) => {
  return request({
    url: '/api/rb-core/core/terminal/terminal/submit',
    method: 'post',
    data: row
  })
}

// 终端管理---类型编号
export const getRptNo = (current, size, params) => {
  return request({
    url: '/api/rb-core/core/terminal/terminal/typeList',
    method: 'get',
    params: {
      current,
      size,
      ...params
    }
  })
}

// 终端管理---供应商编号
export const getRpsNo = (current, size, params) => {
  return request({
    url: '/api/rb-core/core/terminal/terminal/supList',
    method: 'get',
    params: {
      current,
      size,
      ...params
    }
  })
}


// 终端管理---型号
export const getrpmNo = (current, size, params) => {
  return request({
    url: '/api/rb-core/core/terminal/terminal/modelList',
    method: 'get',
    params: {
      current,
      size,
      ...params
    }
  })
}
// 终端管理---商户号
export const getrpiNo = (current, size, params) => {
  return request({
    url: '/api/rb-core/core/terminal/terminal/posInfoList',
    method: 'get',
    params: {
      current,
      size,
      rpiExStatus: 3,
      ...params
    }
  })
}

// 终端管理---门店
export const getstoreNo = (current, size, params) => {
  return request({
    url: '/api/rb-core/core/terminal/terminal/storeList',
    method: 'get',
    params: {
      current,
      size,
      ...params
    }
  })
}

// 终端管理---操作员|收银员
export const getrpstNo = (current, size, params) => {
  return request({
    url: '/api/rb-core/core/terminal/terminal/staffList',
    method: 'get',
    params: {
      current,
      size,
      ...params
    }
  })
}

// 终端管理---新增或修改
export const terminalSubmit = (row) => {
  return request({
    url: '/api/rb-core/core/terminal/terminal/submit',
    method: 'post',
    data: row
  })
}

// 设备管理---门店操作员树结构
export const storeAndMerchantTree = (rpiNo) => {
  return request({
    url: '/api/rb-core/core/terminal/terminal/storeAndMerchantTree',
    method: 'get',
    params: {
      rpiNo
    }
  })
}
// 设备管理---终端树结构
export const terminalTree = (rpiNo) => {
  return request({
    url: '/api/rb-core/core/terminal/terminal/terminalTree',
    method: 'get',
    params: {
      rpiNo
    }
  })
}
// 设备管理---新增或修改
export const equipmentSubmitEq = (row) => {
  return request({
    url: '/api/rb-core/core/terminal/terminal/submitEq',
    method: 'post',
    data: row
  })
}
// 设备管理---详情
export const detailEq = (id) => {
  return request({
    url: '/api/rb-core/core/terminal/terminal/detailEq',
    method: 'get',
    params: {
      id
    }
  })
}

export const queryModuleType = (rpmNo) => {
  return request({
    url: '/api/rb-core/core/terminal/terminal/queryModuleType',
    method: 'get',
    params: {rpmNo}
  })
}

export const getServiceList = () => {
  return request({
    url: '/api/rb-core/core/serviceinfo/service_info/list',
    method: 'get',
    params: {
      current:-1,
      size:-1,
      serviceAuditStatus:2
    }
  })
}

/* 终端管理获取数量 */
export const groupCount = (params) => {
  return request({
    url: '/api/rb-service/service/terminal/terminal/groupCount',
    method: 'get',
    params: {...params}
  })
}

/* 终端管理 导出 */
export const getExport = (params) => {
  return request({
    headers: {
      "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8",
    },
    responseType: 'blob',
    url: '/api/rb-core/core/terminal/terminal/export',
    method: 'get',
    params: {
      ...params,
    }
  })
}

/* 终端管理 导出模板 */
export const getExportTemplate = (params) => {
  return request({
    headers: {
      "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8",
    },
    responseType: 'blob',
    url: '/api/rb-core/core/terminal/terminal/export-template',
    method: 'get',
    params: {
      ...params,
    }
  })
}